package cn.baiweigang.uu.db.repository;

import cn.baiweigang.uu.db.dataobj.StockInfoDo;
import cn.baiweigang.uu.db.mapper.HistoryDayInfoMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
@Slf4j
public class HistoryDayInfoRepository {

    @Autowired
    private HistoryDayInfoMapper historyDayInfoMapper;

    public void insertOrUpdateBatch(List<StockInfoDo> stockInfoDoList) {
        historyDayInfoMapper.insertOrUpdateBatch(stockInfoDoList);
    }

    public void insertOrUpdate(StockInfoDo stockInfoDo) {
        historyDayInfoMapper.insertOrUpdate(stockInfoDo);
    }

    public List<StockInfoDo> queryByDmBeforeDS(String dm, String ds, int limit) {
        return historyDayInfoMapper.queryByDmBeforeDS(dm,ds, limit);
    }

    public List<StockInfoDo> queryByDs(String ds) {
        return historyDayInfoMapper.queryByDs(ds);
    }

    public void updateExt(String id, String ext) {
        historyDayInfoMapper.updateExt(id, ext);
    }


    public void updateRank(String id, String pm) {
        historyDayInfoMapper.updateRank(id, pm);
    }
    public StockInfoDo queryByDmDs(String dm, String ds) {
        return historyDayInfoMapper.queryByDmDs(dm,ds);
    }

    public StockInfoDo queryNewestByDm(String dm) {
        return historyDayInfoMapper.queryNewestByDm(dm);
    }
}
